package com.recruit.wechat.controller;


import com.recruit.wechat.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import com.recruit.wechat.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import com.recruit.wechat.bean.WechatIndustry;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LF
 * @since 2020-08-25
 */
@Controller
@RequestMapping("/WeChatUser/wechatIndustry")
public class WechatIndustryController extends BaseController{
     /** 主页面 */
    @RequestMapping("admin/main.html")
    public String main(){
       return  "wechatIndustry/WechatIndustryMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "admin/addWechatIndustryHtml")
    public String addWechatIndustryHtml( ){
             return "wechatIndustry/WechatIndustryAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/editWechatIndustryHtml")
    public String editWechatIndustryHtml(Integer id ,Model model ){
           model.addAttribute("wechatIndustry",wechatIndustryService.selectWechatIndustryByIdWechatIndustry(id));
             return "wechatIndustry/WechatIndustryEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/showWechatIndustryHtml")
    public String showWechatIndustryHtml(Integer id ,Model model ){
           model.addAttribute("wechatIndustry",wechatIndustryService.selectWechatIndustryByIdWechatIndustry(id));
             return "wechatIndustry/WechatIndustryShow";
    }


    /** 分页查询WechatIndustry
     * @param page  页码
     * @param limit  查几条
     * @param wechatIndustry  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "admin/findWechatIndustryByPage")
    @ResponseBody
    public ResultPage findWechatIndustryByPage(Integer page, Integer limit,WechatIndustry wechatIndustry){
             return wechatIndustryService.findWechatIndustryByPage(page,limit,wechatIndustry);
    }

    /** 添加WechatIndustry
     * @param wechatIndustry  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/addWechatIndustry")
    @ResponseBody
    public ApiResultModel saveWechatIndustry(WechatIndustry wechatIndustry  ){
             return wechatIndustryService.addWechatIndustry(wechatIndustry);
    }

    /** 编辑WechatIndustry
     * @param wechatIndustry  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/editWechatIndustry")
    @ResponseBody
    public ApiResultModel editWechatIndustry(WechatIndustry wechatIndustry  ){
             return wechatIndustryService.editWechatIndustry(wechatIndustry);
    }



    /** 删除一条WechatIndustry
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/delWechatIndustry")
    @ResponseBody
    public ApiResultModel delWechatIndustry( Integer id  ){
             return wechatIndustryService.delWechatIndustry(id);
    }


}
